<?php
/**
 * Created by PhpStorm.
 * User: addd
 * Date: 2020/10/13
 * Time: 9:19
 */
namespace App\Admin\Controllers;

use App\Http\Controllers\Controller;
use App\Models\Zone;
use Encore\Admin\Controllers\HasResourceActions;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;

class ApiController extends Controller
{
    use HasResourceActions;

    public function getadress(Request $request)
    {
       $parent_id = $request->get('q');
       return Zone::where(['parent_id'=>$parent_id])->get(['id',DB::raw('short_name as text')])->toArray();
    }
}